
GameObject = CS.UnityEngine.GameObject
ENV = CS.UnityEngine
function start()
    print(self)
    GameObject.Find("Done"):GetComponent("Button").onClick:AddListener(sure)
end

function sure()

    local faceid = 0
    local chat = GameObject.Find("Chatnode")
    local setpanel = GameObject.Find("Setting")
    local ipname = GameObject.Find("Inputname"):GetComponent("InputField")
    local facepanel = GameObject.Find("Facepanel").transform
    for i =0,facepanel.childCount-1 do 
        local toggle =  facepanel:GetChild(i):GetComponent("Toggle")
        if toggle.isOn then
             faceid = i
             break
        end
    end
    ENV.PlayerPrefs.SetString("name",ipname.text)
    ENV.PlayerPrefs.SetString("faceid",faceid)
    setpanel:SetActive(false)
    chat.transform:GetChild(0).gameObject:SetActive(true)
end

function destory()
    print("Destory")
end
